home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
embedded
/
m68k
/
vubug.arc
/
VUBug.arc
/
VUBug.doc
next >
Wrap
Text File
|
1989-11-13
|
16KB
|
354 lines
VUBug: AN M68000 MONITOR PROGRAM
I. Introduction.
VUBug is a primitive single user monitor program designed
to interface the user to the "Raymatic" M68000 development board
designed by Raymond Carr at Vanderbilt University in 1988. The
monitor program itself was originally written by Edward M. Carter
also while at Vanderbilt in 1983. This documentation relates to
the 1988 version of the program, about two thirds of which is new.
The new stuff was added by Russell G. Brown, then of Vanderbilt, but
lately of Cornell Computer Science. It allows the user to perform
such operations as are necessary to develop and debug M68000
assembly programs in conjunction with a host computer running
an M68000 assembler which is capable of generating object code in
the Motorola S-record format. Some functions provided by VUBUG
are load from host, dump memory, disassemble memory, and run at
address. Feel free to distribute this source and documentation,
but make sure that the copyright and like information stays on it.
Also, please make sure that any modified version of this program
which you may distribute is obviously marked as being modified.
II. Running VUBug
VUbug comes up running as soon as power is applied to the
system. It asserts its presence by printing the following
message:
M68000 Monitor VUBug Version 4.0 27 April, 1988
!_
If there is anything wrong with the system RAM, it will instead
respond
RAM Error!!!!
Assuming that a RAM error doesn't happen, you can now begin
entering commands.
III. Getting Started
The first thing that you will want to do is to load and
execute an assembly language program using VUBug. The following
is an example interactive execution session:
1. Turn on the system. The VUBug boot message prints at the
terminal.
2. Type 'e'. VUBug responds "Terminal Mode:".
3. Log into the host system. Enter vi and type in the
following program:
org $4400
move.l #$00000004,d0
movea.l #$000019ca,a3
adda.w d0,a3
move.l a3,d0
trap #$06
trap #$0
end
4. Write and quit from vi. Assemble the program by
typing
mas68k -l <progname>.
where progname is the name of your sample program. 5.
Examine the listing file produced by mas68k to see the source
and object code together. The listing file is called
<progname.l>.
6. Type 'cat <progname.o>' but DO NOT! type a carriage return.
7. type ctrl-L. VUBug will exit terminal mode, feed a
carriage return to the host, and accept an Srec format object
file.
8. You are now back in VUBug. Type 'a 4400'. You will see an
assembly listing which is equivalent to your source code,
except that it has values substituted for all labels. There
will be a number of garbage lines following the program.
disregard these.
9. Type 'g 4400'. This is the command meaning "go at $4400".
VUBug responds with the following:
Program:
000019ce
!
This is approximately how all debugging sessions should
begin. Once you have become more familiar with VUBug, you will
learn shortcuts and enhancements, but the commands already used
will serve for a start.
IV. VUBug Commands
This section contains the full, alphabetic listing of the
commands provided in VUBug. For information on how to get help
for commands while in VUBug, see the section on 'h'.
A - Assembly Listing
A provides a source code listing of memory locations
specified in one of the following ways:
A<cr> List 20 instructions from last
examined address.
A xxxx List 20 instructions from address
xxxx.
A xxxx,yyyy List from xxxx to yyyy.
B - Set/Remove Breakpoints
B permits the setting and removing of breakpoints in a user
program. B is invoked as follows:
B<cr> List all breakpoints.
B+xxxx Add a breakpoint at address xxxx.
B-xxxx Remove a breakpoint at xxxx.
B# Remove all breakpoints.
C - Copy Memory
C allows the copying of a data block from one location to
another. It is called using:
C xxxx=yyyy,zzzz.
This copies memory from a block which starts at yyyy and
ends at zzzz to a block starting at xxxx. NOTE: the copy
routine works from bottom to top. Therefore care must be
taken when copying between blocks that share address space.
D - Dump Memory
D is used to provide a hex dump of memory. Memory is
printed out in lines consisting of an address, 16 hex
values, and the ascii representation of such of those
values as have printable characters. The format for
calling D is as follows:
D<cr> Dump 64 bytes from last examined
location.
D xxxx Dump 64 bytes from xxxx.
D xxxx,yyyy Dump bytes from xxxx to yyyy.
E - Enter terminal emulator mode
When E is entered, VUBug enters a passthrough mode in which
any key entered at the keyboard is passed through to the
host, and vice versa. This is true for all characters
except for ctrl-X, which causes VUBug to exit terminal
emulator mode, and ctrl-L, which is the same as ctrl-X,
except that it causes VUBug to enter load mode. E is
invoked as follows:
E<cr>
G - Start user program
G is the VUBug command to start a user program running. A
user program which is properly designed to end will have as
its last executed line
trap #$00
G is called in one of the following ways:
G<cr> Go from start address in the last
executed L command.
<cr> Same as G<cr>.
G xxxx Go from address xxxx.
H - Print help messages.
H is used to print a simple message (consisting mostly of
instruction syntax) to the terminal. It is called with:
H<cr> Prints a list of commands for
which help is available.
Hx Prints the long help message for
command x. If x is nonexistant,
Hx acts like H<cr>.
L - Load user program from host
L causes VUBug to accept an S-record format object file
from the host. It is called in one of the following ways:
L<cr> Load from host with no offset.
ctrl-L Same as L<cr> but invoked from
emulator mode.
L xxxx Load from host with offset xxxx.
M - Enter memory update mode
M invokes a submode of VUBug in which modifications to
memory locations can be made. M is invoked as follows:
M<cr> Start memory mode.
M xxxx Start memory mode at xxxx.
Memory mode subcommands are the following:
.xxxx Set pointer to location xxxx.
=xx Update current location to xx.
,xx Increment pointer, then update.
+ Increment pointer.
- Decrement pointer
<cr> Print current pointer and value.
Typing any other character in memory update mode causes an
exit back into VUBug proper.
P - Prototype commands in RAM
P allows the user to create new command subroutines in RAM
and call them without having to burn new ROMs. This is
significant in that ordinarily user programs cannot make
use of the interrupt routines and other subroutines
provided in VUBug. P is set up to allow a user routine to
make use of these subroutines. It is invoked as follows:
Px xxxx Load address xxxx for prototype
command x.
Px<cr> Execute prototype command x.
Note that x must be a 1, 2, or 3.
R - Enter register examine/update mode
R invokes a submode of VUBug in which registers may be
examined and changed. It is called in the following way:
R<cr> Start register mode.
R xx Start mode at register xx,
where xx is one of:
SR/_sr - status register,
PC/_pc - program counter,
dx - data register 0 - 7,
ax - address reg. 0 - 7.
Register examine/update commands are as follows:
.xx Set pointer to register xx.
=xxxxxxxx Set current register to xxxxxxxx.
<cr> Print all registers.
Any other character entered in register submode causes an
exit to VUBug.
S - Single step mode
In single step mode, a Go command causes VUBug to execute a
single instruction and then return to the prompt, allowing
registers to be examined and changed between instructions.
S is called in one of two ways:
S+ Turn on single step mode.
S- Turn off single step mode.
T - Trace mode
In trace mode, a Go command causes VUBug to execute a
program, printing out the PC after each instruction. This
permits tracing of a program's path. It is called as
follows:
T+ Turn on trace mode.
T- Turn off trace mode. V.
U - Upload user program from terminal
U allows VUBug to upload an S-record format object file
from the terminal. This allows the user to connect the
68000 board to a microcomputer, using it as both terminal
and host. Upload is invoked with one of the following
commands:
U<cr> Upload from terminal with no offset.
U xxxx Upload from terminal with offset xxxx.
V. Troubleshooting
There is not a whole lot that can go wrong with VUBug.
Most of the possible difficulties actually have their roots in
hardware. If a RAM error is indicated at boot-up time, then one
of the system RAM chips needs replacing. If no boot-up message
is printed, then something is wrong with one of the following:
the terminal, the terminal cable, the ACIAs on the development
board, the system RAM, or the VUBug ROM.
If an error is found in VUBug's performance, the thing to
do is to document carefully when and where the bug appears, and
report the problem to the nearest digital electronics professor.
VI. Caveats
A number of things should be taken into account when using
VUBug. Most of these have to do with the memory map. Number
one is that hitting the reset button invokes the RAM test program
which CLEARS THE RAM! For this reason, ctrl-C should be used to
recover control from a lost program.
The memory map for the board looks like this:
0000 - 3FFF System ROM
4000 - 43FF System RAM
4400 - 7FFF User RAM
8000 - 803E PI/T (68230) registers EVEN ONLY!
A000 Load Port Status Register
A002 Load Port Data Register
C000 Terminal Port Status Register
C002 Terminal Port Data Register
Note that the PI/T and ACIA registers are on even only
locations. Attempting to write to a peripheral chip on an odd
location will lock up the system. Similarly, writing to system
RAM can cause unexpected results, up to and including locking
up the system.
VII. Conclusion
VUBug 4.0, mas68k, and the Raymatic development board form
an effective development environment for M68000 assembly
language programs. While they cannot substitute for
professional development/analysis systems, it is nevertheless
possible to complete considerable software endeavors with a
reasonable minimum of difficulty.